﻿<%@ Page Language="C#" MasterPageFile="~/design/Admin.Master" AutoEventWireup="true"
    CodeFile="Uzivatele.aspx.cs" Inherits="Zadani09.admin.Uzivatele" Title="Správa uživatelů" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="LoginPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MenuPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentVrchniPlaceholder" runat="server">
    <h2 style="margin-bottom: 2px">Seznam uživatelů pro admina</h2>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
        <ContentTemplate>
            <asp:TextBox ID="TextBox1" runat="server">
            </asp:TextBox>
            <cc1:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" 
                DelimiterCharacters="" Enabled="True" ServicePath="" TargetControlID="TextBox1" 
                UseContextKey="True" ServiceMethod="GetCompletionList" 
                MinimumPrefixLength="1">
            </cc1:AutoCompleteExtender>
            &nbsp;
            <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
                <asp:ListItem Value="id_uzivatel" Text="ID uživatele"></asp:ListItem>
                <asp:ListItem Value="login_uzivatel" Text="Login"></asp:ListItem>
                <asp:ListItem Value="posledni_zmena_hesla" Text="Poslední změna hesla"></asp:ListItem>
                <asp:ListItem Value="jmeno" Text="Jméno"></asp:ListItem>
                <asp:ListItem Value="prijmeni" Text="Příjmení"></asp:ListItem>
                <asp:ListItem Value="email" Text="Email"></asp:ListItem>
                <asp:ListItem Value="ulice" Text="Ulice"></asp:ListItem>
                <asp:ListItem Value="popisne" Text="Číslo popisné"></asp:ListItem>
                <asp:ListItem Value="mesto" Text="Město"></asp:ListItem>
                <asp:ListItem Value="psc" Text="PSČ"></asp:ListItem>
            </asp:DropDownList>
        </ContentTemplate>
    </asp:UpdatePanel>
    &nbsp;
    <asp:Button ID="Button1" runat="server" Text="Vyhledat" Font-Size="12px" onclick="Button1_Click" />
    <asp:GridView ID="GridView1" runat="server" BackColor="LightGoldenrodYellow" BorderColor="Tan"
        BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" Width="740px"
        AllowPaging="True" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1"
        DataKeyNames="IDUzivatel" CssClass="mar_top_3" 
        onselectedindexchanged="GridView1_SelectedIndexChanged">
        <FooterStyle BackColor="Tan" />
        <Columns>
            <asp:CommandField SelectText="Detail" ShowSelectButton="True" 
                DeleteText="Smazat" ShowDeleteButton="True">
                <ItemStyle Font-Bold="True" />
            </asp:CommandField>
            <asp:BoundField DataField="IDUzivatel" HeaderText="ID" SortExpression="IDUzivatel" />
            <asp:BoundField DataField="LoginUzivatel" HeaderText="Login" SortExpression="LoginUzivatel" />
            <asp:BoundField DataField="LoginHesloHash" HeaderText="Heslo" SortExpression="LoginHesloHash"
                Visible="False" />
            <asp:BoundField DataField="Jmeno" HeaderText="Jméno" SortExpression="Jmeno" />
            <asp:BoundField DataField="Prijmeni" HeaderText="Příjmení" SortExpression="Prijmeni" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="Ulice" HeaderText="Ulice" SortExpression="Ulice" 
                Visible="False" />
            <asp:BoundField DataField="Popisne" HeaderText="Popisné" 
                SortExpression="Popisne" Visible="False" />
            <asp:BoundField DataField="Mesto" HeaderText="Město" SortExpression="Mesto" 
                Visible="False" />
            <asp:BoundField DataField="PSC" HeaderText="PSČ" SortExpression="PSC" 
                Visible="False" />
            <asp:BoundField DataField="PosledniZmenaHesla" HeaderText="Posl. změna hesla" SortExpression="PosledniZmenaHesla" />
            <asp:TemplateField HeaderText="Stav" SortExpression="Stav">
                <ItemTemplate>
                    <asp:Label ID="LabelStav" runat="server" Text='<%# (Eval("Stav").ToString() == "1" ? "aktivní" : "neaktivní") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:GridView>
    <h2 style="margin-bottom: 2px">Přidání a editace uživatele</h2>
    <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="417px" AutoGenerateRows="False"
        BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px" CellPadding="2"
        ForeColor="Black" GridLines="None" DataSourceID="ObjectDataSource2" DataKeyNames="IDUzivatel">
        <FooterStyle BackColor="Tan" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
        <Fields>
            <asp:BoundField DataField="IDUzivatel" HeaderText="ID" SortExpression="IDUzivatel"
                InsertVisible="False" ReadOnly="True">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="LoginUzivatel" HeaderText="Login" SortExpression="LoginUzivatel">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="LoginHesloHash" HeaderText="Heslo" SortExpression="LoginHesloHash">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Jmeno" HeaderText="Jméno" SortExpression="Jmeno">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Prijmeni" HeaderText="Příjmení" SortExpression="Prijmeni">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Ulice" HeaderText="Ulice" SortExpression="Ulice">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Popisne" HeaderText="Popisné" SortExpression="Popisne">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="Mesto" HeaderText="Město" SortExpression="Mesto">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="PSC" HeaderText="PSČ" SortExpression="PSC">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:BoundField DataField="PosledniZmenaHesla" HeaderText="Poslední změna hesla"
                SortExpression="PosledniZmenaHesla" InsertVisible="False" ReadOnly="True">
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="Stav" SortExpression="Stav">
                <EditItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" Height="20px" SelectedValue='<%# Bind("Stav") %>'
                        Width="150px">
                        <asp:ListItem Value="1">Aktivní</asp:ListItem>
                        <asp:ListItem Value="0">Neaktivní</asp:ListItem>
                    </asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="DropDownList2" runat="server" Height="20px" SelectedValue='<%# Bind("Stav") %>'
                        Width="150px">
                        <asp:ListItem Value="1">Aktivní</asp:ListItem>
                        <asp:ListItem Value="0">Neaktivní</asp:ListItem>
                    </asp:DropDownList>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# (Eval("Stav").ToString() == "1" ? "aktivní" : "neaktivní") %>'></asp:Label>
                </ItemTemplate>
                <HeaderStyle Font-Bold="True" />
                <ItemStyle Font-Bold="False" />
            </asp:TemplateField>
            <asp:CommandField ShowEditButton="True" EditText="Upravit" InsertText="Vložit" NewText="Vložit nového uživatele"
                ShowInsertButton="True">
                <ItemStyle Font-Bold="True" ForeColor="Red" />
            </asp:CommandField>
        </Fields>
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <EditRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
    </asp:DetailsView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="Zadani09.db.Uzivatel"
        DeleteMethod="smaz" InsertMethod="vloz" OldValuesParameterFormatString="original_{0}"
        SelectMethod="cti_s_vyhledavanim" TypeName="Zadani09.db.ODS.UzivatelDataObject" UpdateMethod="aktualizuj"
        EnableCaching="false">
        <SelectParameters>
            <asp:Parameter Name="razeni" Type="String" />
            <asp:ControlParameter ControlID="TextBox1" DefaultValue="" Name="hledano" PropertyName="Text" Type="String" />
            <asp:ControlParameter ControlID="DropDownList1" DefaultValue="id_umelec" Name="atribut" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DataObjectTypeName="Zadani09.db.Uzivatel"
        OldValuesParameterFormatString="original_{0}" SelectMethod="ctiJednoho" TypeName="Zadani09.db.ODS.UzivatelDataObject"
        UpdateMethod="aktualizuj" InsertMethod="vloz">
        <SelectParameters>
            <asp:ControlParameter ControlID="GridView1" DefaultValue="1" Name="id" PropertyName="SelectedValue"
                Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentSpodniPlaceholder" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="BottomPlaceholder" runat="server">
</asp:Content>
